// Generated from C:/Users/wayne/Desktop/CMMWithIDE/src\Cmm.g4 by ANTLR 4.7
package parser;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;

@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class CmmParser extends Parser {
	static { RuntimeMetaData.checkVersion("4.7", RuntimeMetaData.VERSION); }

	protected static final DFA[] _decisionToDFA;
	protected static final PredictionContextCache _sharedContextCache =
		new PredictionContextCache();
	public static final int
		FOR=1, IF=2, ELSE=3, ELSE_IF=4, WHILE=5, BREAK=6, Continue=7, T_DOUBLE=8, 
		T_INT=9, T_BOOL=10, WRITE=11, READ=12, L_PAREN=13, R_PAREN=14, L_BRACKET=15, 
		R_BRACKET=16, L_BRACE=17, R_BRACE=18, NO_LESS=19, NO_MORE=20, EQUAL=21, 
		UN_EQUAL=22, BIGGER_THAN=23, LESS_THAN=24, LOG_NOT=25, LOG_OR=26, LOG_AND=27, 
		PLUS=28, MINUS=29, MUL=30, DIV=31, MOD=32, SEMI=33, COMMA=34, ASSIGN=35, 
		ID=36, INT=37, DOUBLE=38, ESCAPE=39, WS=40, NEW_LINE=41, B_COMMENT=42, 
		L_COMMENT=43;
	public static final int
		RULE_program = 0, RULE_stmt = 1, RULE_declStmt = 2, RULE_deAs = 3, RULE_ifStmt = 4, 
		RULE_elseIfStmt = 5, RULE_elseStmt = 6, RULE_whileStmt = 7, RULE_assignStmt = 8, 
		RULE_writeStmt = 9, RULE_readStmt = 10, RULE_stmtBlock = 11, RULE_forStmt = 12, 
		RULE_type = 13, RULE_variable = 14, RULE_constant = 15, RULE_compare = 16, 
		RULE_expr = 17;
	public static final String[] ruleNames = {
		"program", "stmt", "declStmt", "deAs", "ifStmt", "elseIfStmt", "elseStmt", 
		"whileStmt", "assignStmt", "writeStmt", "readStmt", "stmtBlock", "forStmt", 
		"type", "variable", "constant", "compare", "expr"
	};

	private static final String[] _LITERAL_NAMES = {
		null, "'for'", "'if'", "'else'", "'else if'", "'while'", "'break'", "'continue'", 
		"'double'", "'int'", "'bool'", "'write'", "'read'", "'('", "')'", "'['", 
		"']'", "'{'", "'}'", "'>='", "'<='", "'=='", "'!='", "'>'", "'<'", "'!'", 
		"'||'", "'&&'", "'+'", "'-'", "'*'", "'/'", "'%'", "';'", "','", "'='"
	};
	private static final String[] _SYMBOLIC_NAMES = {
		null, "FOR", "IF", "ELSE", "ELSE_IF", "WHILE", "BREAK", "Continue", "T_DOUBLE", 
		"T_INT", "T_BOOL", "WRITE", "READ", "L_PAREN", "R_PAREN", "L_BRACKET", 
		"R_BRACKET", "L_BRACE", "R_BRACE", "NO_LESS", "NO_MORE", "EQUAL", "UN_EQUAL", 
		"BIGGER_THAN", "LESS_THAN", "LOG_NOT", "LOG_OR", "LOG_AND", "PLUS", "MINUS", 
		"MUL", "DIV", "MOD", "SEMI", "COMMA", "ASSIGN", "ID", "INT", "DOUBLE", 
		"ESCAPE", "WS", "NEW_LINE", "B_COMMENT", "L_COMMENT"
	};
	public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);

	/**
	 * @deprecated Use {@link #VOCABULARY} instead.
	 */
	@Deprecated
	public static final String[] tokenNames;
	static {
		tokenNames = new String[_SYMBOLIC_NAMES.length];
		for (int i = 0; i < tokenNames.length; i++) {
			tokenNames[i] = VOCABULARY.getLiteralName(i);
			if (tokenNames[i] == null) {
				tokenNames[i] = VOCABULARY.getSymbolicName(i);
			}

			if (tokenNames[i] == null) {
				tokenNames[i] = "<INVALID>";
			}
		}
	}

	@Override
	@Deprecated
	public String[] getTokenNames() {
		return tokenNames;
	}

	@Override

	public Vocabulary getVocabulary() {
		return VOCABULARY;
	}

	@Override
	public String getGrammarFileName() { return "Cmm.g4"; }

	@Override
	public String[] getRuleNames() { return ruleNames; }

	@Override
	public String getSerializedATN() { return _serializedATN; }

	@Override
	public ATN getATN() { return _ATN; }

	public CmmParser(TokenStream input) {
		super(input);
		_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
	}
	public static class ProgramContext extends ParserRuleContext {
		public List<StmtContext> stmt() {
			return getRuleContexts(StmtContext.class);
		}
		public StmtContext stmt(int i) {
			return getRuleContext(StmtContext.class,i);
		}
		public ProgramContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_program; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterProgram(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitProgram(this);
		}
	}

	public final ProgramContext program() throws RecognitionException {
		ProgramContext _localctx = new ProgramContext(_ctx, getState());
		enterRule(_localctx, 0, RULE_program);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(37); 
			_errHandler.sync(this);
			_la = _input.LA(1);
			do {
				{
				{
				setState(36);
				stmt();
				}
				}
				setState(39); 
				_errHandler.sync(this);
				_la = _input.LA(1);
			} while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << FOR) | (1L << IF) | (1L << WHILE) | (1L << T_DOUBLE) | (1L << T_INT) | (1L << T_BOOL) | (1L << WRITE) | (1L << READ) | (1L << L_BRACE) | (1L << ID))) != 0) );
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class StmtContext extends ParserRuleContext {
		public DeclStmtContext declStmt() {
			return getRuleContext(DeclStmtContext.class,0);
		}
		public IfStmtContext ifStmt() {
			return getRuleContext(IfStmtContext.class,0);
		}
		public WhileStmtContext whileStmt() {
			return getRuleContext(WhileStmtContext.class,0);
		}
		public AssignStmtContext assignStmt() {
			return getRuleContext(AssignStmtContext.class,0);
		}
		public TerminalNode SEMI() { return getToken(CmmParser.SEMI, 0); }
		public WriteStmtContext writeStmt() {
			return getRuleContext(WriteStmtContext.class,0);
		}
		public ReadStmtContext readStmt() {
			return getRuleContext(ReadStmtContext.class,0);
		}
		public StmtBlockContext stmtBlock() {
			return getRuleContext(StmtBlockContext.class,0);
		}
		public ForStmtContext forStmt() {
			return getRuleContext(ForStmtContext.class,0);
		}
		public StmtContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_stmt; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterStmt(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitStmt(this);
		}
	}

	public final StmtContext stmt() throws RecognitionException {
		StmtContext _localctx = new StmtContext(_ctx, getState());
		enterRule(_localctx, 2, RULE_stmt);
		try {
			setState(51);
			_errHandler.sync(this);
			switch (_input.LA(1)) {
			case T_DOUBLE:
			case T_INT:
			case T_BOOL:
				enterOuterAlt(_localctx, 1);
				{
				setState(41);
				declStmt();
				}
				break;
			case IF:
				enterOuterAlt(_localctx, 2);
				{
				setState(42);
				ifStmt();
				}
				break;
			case WHILE:
				enterOuterAlt(_localctx, 3);
				{
				setState(43);
				whileStmt();
				}
				break;
			case ID:
				enterOuterAlt(_localctx, 4);
				{
				{
				setState(44);
				assignStmt();
				setState(45);
				match(SEMI);
				}
				}
				break;
			case WRITE:
				enterOuterAlt(_localctx, 5);
				{
				setState(47);
				writeStmt();
				}
				break;
			case READ:
				enterOuterAlt(_localctx, 6);
				{
				setState(48);
				readStmt();
				}
				break;
			case L_BRACE:
				enterOuterAlt(_localctx, 7);
				{
				setState(49);
				stmtBlock();
				}
				break;
			case FOR:
				enterOuterAlt(_localctx, 8);
				{
				setState(50);
				forStmt();
				}
				break;
			default:
				throw new NoViableAltException(this);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class DeclStmtContext extends ParserRuleContext {
		public DeclStmtContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_declStmt; }
	 
		public DeclStmtContext() { }
		public void copyFrom(DeclStmtContext ctx) {
			super.copyFrom(ctx);
		}
	}
	public static class DeclStmt1Context extends DeclStmtContext {
		public TypeContext type() {
			return getRuleContext(TypeContext.class,0);
		}
		public List<DeAsContext> deAs() {
			return getRuleContexts(DeAsContext.class);
		}
		public DeAsContext deAs(int i) {
			return getRuleContext(DeAsContext.class,i);
		}
		public TerminalNode SEMI() { return getToken(CmmParser.SEMI, 0); }
		public List<TerminalNode> COMMA() { return getTokens(CmmParser.COMMA); }
		public TerminalNode COMMA(int i) {
			return getToken(CmmParser.COMMA, i);
		}
		public DeclStmt1Context(DeclStmtContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterDeclStmt1(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitDeclStmt1(this);
		}
	}
	public static class DeclStmt2Context extends DeclStmtContext {
		public TypeContext type() {
			return getRuleContext(TypeContext.class,0);
		}
		public TerminalNode L_BRACKET() { return getToken(CmmParser.L_BRACKET, 0); }
		public TerminalNode INT() { return getToken(CmmParser.INT, 0); }
		public TerminalNode R_BRACKET() { return getToken(CmmParser.R_BRACKET, 0); }
		public TerminalNode ID() { return getToken(CmmParser.ID, 0); }
		public TerminalNode SEMI() { return getToken(CmmParser.SEMI, 0); }
		public DeclStmt2Context(DeclStmtContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterDeclStmt2(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitDeclStmt2(this);
		}
	}

	public final DeclStmtContext declStmt() throws RecognitionException {
		DeclStmtContext _localctx = new DeclStmtContext(_ctx, getState());
		enterRule(_localctx, 4, RULE_declStmt);
		int _la;
		try {
			setState(71);
			_errHandler.sync(this);
			switch ( getInterpreter().adaptivePredict(_input,3,_ctx) ) {
			case 1:
				_localctx = new DeclStmt1Context(_localctx);
				enterOuterAlt(_localctx, 1);
				{
				setState(53);
				type();
				setState(54);
				deAs();
				setState(59);
				_errHandler.sync(this);
				_la = _input.LA(1);
				while (_la==COMMA) {
					{
					{
					setState(55);
					match(COMMA);
					setState(56);
					deAs();
					}
					}
					setState(61);
					_errHandler.sync(this);
					_la = _input.LA(1);
				}
				setState(62);
				match(SEMI);
				}
				break;
			case 2:
				_localctx = new DeclStmt2Context(_localctx);
				enterOuterAlt(_localctx, 2);
				{
				setState(64);
				type();
				setState(65);
				match(L_BRACKET);
				setState(66);
				match(INT);
				setState(67);
				match(R_BRACKET);
				setState(68);
				match(ID);
				setState(69);
				match(SEMI);
				}
				break;
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class DeAsContext extends ParserRuleContext {
		public DeAsContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_deAs; }
	 
		public DeAsContext() { }
		public void copyFrom(DeAsContext ctx) {
			super.copyFrom(ctx);
		}
	}
	public static class DeAs3Context extends DeAsContext {
		public TerminalNode ID() { return getToken(CmmParser.ID, 0); }
		public TerminalNode ASSIGN() { return getToken(CmmParser.ASSIGN, 0); }
		public TerminalNode MINUS() { return getToken(CmmParser.MINUS, 0); }
		public ExprContext expr() {
			return getRuleContext(ExprContext.class,0);
		}
		public DeAs3Context(DeAsContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterDeAs3(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitDeAs3(this);
		}
	}
	public static class DeAs1Context extends DeAsContext {
		public TerminalNode ID() { return getToken(CmmParser.ID, 0); }
		public DeAs1Context(DeAsContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterDeAs1(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitDeAs1(this);
		}
	}
	public static class DeAs2Context extends DeAsContext {
		public TerminalNode ID() { return getToken(CmmParser.ID, 0); }
		public TerminalNode ASSIGN() { return getToken(CmmParser.ASSIGN, 0); }
		public ExprContext expr() {
			return getRuleContext(ExprContext.class,0);
		}
		public DeAs2Context(DeAsContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterDeAs2(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitDeAs2(this);
		}
	}

	public final DeAsContext deAs() throws RecognitionException {
		DeAsContext _localctx = new DeAsContext(_ctx, getState());
		enterRule(_localctx, 6, RULE_deAs);
		try {
			setState(81);
			_errHandler.sync(this);
			switch ( getInterpreter().adaptivePredict(_input,4,_ctx) ) {
			case 1:
				_localctx = new DeAs1Context(_localctx);
				enterOuterAlt(_localctx, 1);
				{
				setState(73);
				match(ID);
				}
				break;
			case 2:
				_localctx = new DeAs2Context(_localctx);
				enterOuterAlt(_localctx, 2);
				{
				setState(74);
				match(ID);
				setState(75);
				match(ASSIGN);
				setState(76);
				expr(0);
				}
				break;
			case 3:
				_localctx = new DeAs3Context(_localctx);
				enterOuterAlt(_localctx, 3);
				{
				setState(77);
				match(ID);
				setState(78);
				match(ASSIGN);
				setState(79);
				match(MINUS);
				setState(80);
				expr(0);
				}
				break;
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class IfStmtContext extends ParserRuleContext {
		public TerminalNode IF() { return getToken(CmmParser.IF, 0); }
		public TerminalNode L_PAREN() { return getToken(CmmParser.L_PAREN, 0); }
		public CompareContext compare() {
			return getRuleContext(CompareContext.class,0);
		}
		public TerminalNode R_PAREN() { return getToken(CmmParser.R_PAREN, 0); }
		public StmtBlockContext stmtBlock() {
			return getRuleContext(StmtBlockContext.class,0);
		}
		public List<ElseIfStmtContext> elseIfStmt() {
			return getRuleContexts(ElseIfStmtContext.class);
		}
		public ElseIfStmtContext elseIfStmt(int i) {
			return getRuleContext(ElseIfStmtContext.class,i);
		}
		public ElseStmtContext elseStmt() {
			return getRuleContext(ElseStmtContext.class,0);
		}
		public IfStmtContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_ifStmt; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterIfStmt(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitIfStmt(this);
		}
	}

	public final IfStmtContext ifStmt() throws RecognitionException {
		IfStmtContext _localctx = new IfStmtContext(_ctx, getState());
		enterRule(_localctx, 8, RULE_ifStmt);
		int _la;
		try {
			setState(107);
			_errHandler.sync(this);
			switch ( getInterpreter().adaptivePredict(_input,7,_ctx) ) {
			case 1:
				enterOuterAlt(_localctx, 1);
				{
				setState(83);
				match(IF);
				setState(84);
				match(L_PAREN);
				setState(85);
				compare();
				setState(86);
				match(R_PAREN);
				setState(87);
				stmtBlock();
				setState(91);
				_errHandler.sync(this);
				_la = _input.LA(1);
				while (_la==ELSE_IF) {
					{
					{
					setState(88);
					elseIfStmt();
					}
					}
					setState(93);
					_errHandler.sync(this);
					_la = _input.LA(1);
				}
				}
				break;
			case 2:
				enterOuterAlt(_localctx, 2);
				{
				setState(94);
				match(IF);
				setState(95);
				match(L_PAREN);
				setState(96);
				compare();
				setState(97);
				match(R_PAREN);
				setState(98);
				stmtBlock();
				setState(102);
				_errHandler.sync(this);
				_la = _input.LA(1);
				while (_la==ELSE_IF) {
					{
					{
					setState(99);
					elseIfStmt();
					}
					}
					setState(104);
					_errHandler.sync(this);
					_la = _input.LA(1);
				}
				setState(105);
				elseStmt();
				}
				break;
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class ElseIfStmtContext extends ParserRuleContext {
		public TerminalNode ELSE_IF() { return getToken(CmmParser.ELSE_IF, 0); }
		public TerminalNode L_PAREN() { return getToken(CmmParser.L_PAREN, 0); }
		public CompareContext compare() {
			return getRuleContext(CompareContext.class,0);
		}
		public TerminalNode R_PAREN() { return getToken(CmmParser.R_PAREN, 0); }
		public StmtBlockContext stmtBlock() {
			return getRuleContext(StmtBlockContext.class,0);
		}
		public ElseIfStmtContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_elseIfStmt; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterElseIfStmt(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitElseIfStmt(this);
		}
	}

	public final ElseIfStmtContext elseIfStmt() throws RecognitionException {
		ElseIfStmtContext _localctx = new ElseIfStmtContext(_ctx, getState());
		enterRule(_localctx, 10, RULE_elseIfStmt);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(109);
			match(ELSE_IF);
			setState(110);
			match(L_PAREN);
			setState(111);
			compare();
			setState(112);
			match(R_PAREN);
			setState(113);
			stmtBlock();
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class ElseStmtContext extends ParserRuleContext {
		public TerminalNode ELSE() { return getToken(CmmParser.ELSE, 0); }
		public StmtBlockContext stmtBlock() {
			return getRuleContext(StmtBlockContext.class,0);
		}
		public ElseStmtContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_elseStmt; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterElseStmt(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitElseStmt(this);
		}
	}

	public final ElseStmtContext elseStmt() throws RecognitionException {
		ElseStmtContext _localctx = new ElseStmtContext(_ctx, getState());
		enterRule(_localctx, 12, RULE_elseStmt);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(115);
			match(ELSE);
			setState(116);
			stmtBlock();
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class WhileStmtContext extends ParserRuleContext {
		public TerminalNode WHILE() { return getToken(CmmParser.WHILE, 0); }
		public TerminalNode L_PAREN() { return getToken(CmmParser.L_PAREN, 0); }
		public CompareContext compare() {
			return getRuleContext(CompareContext.class,0);
		}
		public TerminalNode R_PAREN() { return getToken(CmmParser.R_PAREN, 0); }
		public StmtBlockContext stmtBlock() {
			return getRuleContext(StmtBlockContext.class,0);
		}
		public WhileStmtContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_whileStmt; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterWhileStmt(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitWhileStmt(this);
		}
	}

	public final WhileStmtContext whileStmt() throws RecognitionException {
		WhileStmtContext _localctx = new WhileStmtContext(_ctx, getState());
		enterRule(_localctx, 14, RULE_whileStmt);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(118);
			match(WHILE);
			setState(119);
			match(L_PAREN);
			setState(120);
			compare();
			setState(121);
			match(R_PAREN);
			setState(122);
			stmtBlock();
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class AssignStmtContext extends ParserRuleContext {
		public AssignStmtContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_assignStmt; }
	 
		public AssignStmtContext() { }
		public void copyFrom(AssignStmtContext ctx) {
			super.copyFrom(ctx);
		}
	}
	public static class AssignStmt2Context extends AssignStmtContext {
		public VariableContext variable() {
			return getRuleContext(VariableContext.class,0);
		}
		public TerminalNode ASSIGN() { return getToken(CmmParser.ASSIGN, 0); }
		public TerminalNode MINUS() { return getToken(CmmParser.MINUS, 0); }
		public ExprContext expr() {
			return getRuleContext(ExprContext.class,0);
		}
		public AssignStmt2Context(AssignStmtContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterAssignStmt2(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitAssignStmt2(this);
		}
	}
	public static class AssignStmt1Context extends AssignStmtContext {
		public VariableContext variable() {
			return getRuleContext(VariableContext.class,0);
		}
		public TerminalNode ASSIGN() { return getToken(CmmParser.ASSIGN, 0); }
		public ExprContext expr() {
			return getRuleContext(ExprContext.class,0);
		}
		public AssignStmt1Context(AssignStmtContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterAssignStmt1(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitAssignStmt1(this);
		}
	}

	public final AssignStmtContext assignStmt() throws RecognitionException {
		AssignStmtContext _localctx = new AssignStmtContext(_ctx, getState());
		enterRule(_localctx, 16, RULE_assignStmt);
		try {
			setState(133);
			_errHandler.sync(this);
			switch ( getInterpreter().adaptivePredict(_input,8,_ctx) ) {
			case 1:
				_localctx = new AssignStmt1Context(_localctx);
				enterOuterAlt(_localctx, 1);
				{
				setState(124);
				variable();
				setState(125);
				match(ASSIGN);
				setState(126);
				expr(0);
				}
				break;
			case 2:
				_localctx = new AssignStmt2Context(_localctx);
				enterOuterAlt(_localctx, 2);
				{
				setState(128);
				variable();
				setState(129);
				match(ASSIGN);
				setState(130);
				match(MINUS);
				setState(131);
				expr(0);
				}
				break;
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class WriteStmtContext extends ParserRuleContext {
		public TerminalNode WRITE() { return getToken(CmmParser.WRITE, 0); }
		public TerminalNode L_PAREN() { return getToken(CmmParser.L_PAREN, 0); }
		public ExprContext expr() {
			return getRuleContext(ExprContext.class,0);
		}
		public TerminalNode R_PAREN() { return getToken(CmmParser.R_PAREN, 0); }
		public TerminalNode SEMI() { return getToken(CmmParser.SEMI, 0); }
		public WriteStmtContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_writeStmt; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterWriteStmt(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitWriteStmt(this);
		}
	}

	public final WriteStmtContext writeStmt() throws RecognitionException {
		WriteStmtContext _localctx = new WriteStmtContext(_ctx, getState());
		enterRule(_localctx, 18, RULE_writeStmt);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(135);
			match(WRITE);
			setState(136);
			match(L_PAREN);
			setState(137);
			expr(0);
			setState(138);
			match(R_PAREN);
			setState(139);
			match(SEMI);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class ReadStmtContext extends ParserRuleContext {
		public TerminalNode READ() { return getToken(CmmParser.READ, 0); }
		public TerminalNode L_PAREN() { return getToken(CmmParser.L_PAREN, 0); }
		public VariableContext variable() {
			return getRuleContext(VariableContext.class,0);
		}
		public TerminalNode R_PAREN() { return getToken(CmmParser.R_PAREN, 0); }
		public TerminalNode SEMI() { return getToken(CmmParser.SEMI, 0); }
		public ReadStmtContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_readStmt; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterReadStmt(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitReadStmt(this);
		}
	}

	public final ReadStmtContext readStmt() throws RecognitionException {
		ReadStmtContext _localctx = new ReadStmtContext(_ctx, getState());
		enterRule(_localctx, 20, RULE_readStmt);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(141);
			match(READ);
			setState(142);
			match(L_PAREN);
			setState(143);
			variable();
			setState(144);
			match(R_PAREN);
			setState(145);
			match(SEMI);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class StmtBlockContext extends ParserRuleContext {
		public TerminalNode L_BRACE() { return getToken(CmmParser.L_BRACE, 0); }
		public TerminalNode R_BRACE() { return getToken(CmmParser.R_BRACE, 0); }
		public List<StmtContext> stmt() {
			return getRuleContexts(StmtContext.class);
		}
		public StmtContext stmt(int i) {
			return getRuleContext(StmtContext.class,i);
		}
		public StmtBlockContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_stmtBlock; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterStmtBlock(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitStmtBlock(this);
		}
	}

	public final StmtBlockContext stmtBlock() throws RecognitionException {
		StmtBlockContext _localctx = new StmtBlockContext(_ctx, getState());
		enterRule(_localctx, 22, RULE_stmtBlock);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(147);
			match(L_BRACE);
			setState(151);
			_errHandler.sync(this);
			_la = _input.LA(1);
			while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << FOR) | (1L << IF) | (1L << WHILE) | (1L << T_DOUBLE) | (1L << T_INT) | (1L << T_BOOL) | (1L << WRITE) | (1L << READ) | (1L << L_BRACE) | (1L << ID))) != 0)) {
				{
				{
				setState(148);
				stmt();
				}
				}
				setState(153);
				_errHandler.sync(this);
				_la = _input.LA(1);
			}
			setState(154);
			match(R_BRACE);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class ForStmtContext extends ParserRuleContext {
		public ForStmtContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_forStmt; }
	 
		public ForStmtContext() { }
		public void copyFrom(ForStmtContext ctx) {
			super.copyFrom(ctx);
		}
	}
	public static class ForStmt1Context extends ForStmtContext {
		public TerminalNode FOR() { return getToken(CmmParser.FOR, 0); }
		public TerminalNode L_PAREN() { return getToken(CmmParser.L_PAREN, 0); }
		public List<AssignStmtContext> assignStmt() {
			return getRuleContexts(AssignStmtContext.class);
		}
		public AssignStmtContext assignStmt(int i) {
			return getRuleContext(AssignStmtContext.class,i);
		}
		public List<TerminalNode> SEMI() { return getTokens(CmmParser.SEMI); }
		public TerminalNode SEMI(int i) {
			return getToken(CmmParser.SEMI, i);
		}
		public CompareContext compare() {
			return getRuleContext(CompareContext.class,0);
		}
		public TerminalNode R_PAREN() { return getToken(CmmParser.R_PAREN, 0); }
		public StmtBlockContext stmtBlock() {
			return getRuleContext(StmtBlockContext.class,0);
		}
		public ForStmt1Context(ForStmtContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterForStmt1(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitForStmt1(this);
		}
	}
	public static class ForStmt2Context extends ForStmtContext {
		public TerminalNode FOR() { return getToken(CmmParser.FOR, 0); }
		public TerminalNode L_PAREN() { return getToken(CmmParser.L_PAREN, 0); }
		public DeclStmtContext declStmt() {
			return getRuleContext(DeclStmtContext.class,0);
		}
		public CompareContext compare() {
			return getRuleContext(CompareContext.class,0);
		}
		public TerminalNode SEMI() { return getToken(CmmParser.SEMI, 0); }
		public AssignStmtContext assignStmt() {
			return getRuleContext(AssignStmtContext.class,0);
		}
		public TerminalNode R_PAREN() { return getToken(CmmParser.R_PAREN, 0); }
		public StmtBlockContext stmtBlock() {
			return getRuleContext(StmtBlockContext.class,0);
		}
		public ForStmt2Context(ForStmtContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterForStmt2(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitForStmt2(this);
		}
	}

	public final ForStmtContext forStmt() throws RecognitionException {
		ForStmtContext _localctx = new ForStmtContext(_ctx, getState());
		enterRule(_localctx, 24, RULE_forStmt);
		try {
			setState(175);
			_errHandler.sync(this);
			switch ( getInterpreter().adaptivePredict(_input,10,_ctx) ) {
			case 1:
				_localctx = new ForStmt1Context(_localctx);
				enterOuterAlt(_localctx, 1);
				{
				setState(156);
				match(FOR);
				setState(157);
				match(L_PAREN);
				setState(158);
				assignStmt();
				setState(159);
				match(SEMI);
				setState(160);
				compare();
				setState(161);
				match(SEMI);
				setState(162);
				assignStmt();
				setState(163);
				match(R_PAREN);
				setState(164);
				stmtBlock();
				}
				break;
			case 2:
				_localctx = new ForStmt2Context(_localctx);
				enterOuterAlt(_localctx, 2);
				{
				setState(166);
				match(FOR);
				setState(167);
				match(L_PAREN);
				setState(168);
				declStmt();
				setState(169);
				compare();
				setState(170);
				match(SEMI);
				setState(171);
				assignStmt();
				setState(172);
				match(R_PAREN);
				setState(173);
				stmtBlock();
				}
				break;
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class TypeContext extends ParserRuleContext {
		public TypeContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_type; }
	 
		public TypeContext() { }
		public void copyFrom(TypeContext ctx) {
			super.copyFrom(ctx);
		}
	}
	public static class Type3Context extends TypeContext {
		public TerminalNode T_BOOL() { return getToken(CmmParser.T_BOOL, 0); }
		public Type3Context(TypeContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterType3(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitType3(this);
		}
	}
	public static class Type2Context extends TypeContext {
		public TerminalNode T_DOUBLE() { return getToken(CmmParser.T_DOUBLE, 0); }
		public Type2Context(TypeContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterType2(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitType2(this);
		}
	}
	public static class Type1Context extends TypeContext {
		public TerminalNode T_INT() { return getToken(CmmParser.T_INT, 0); }
		public Type1Context(TypeContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterType1(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitType1(this);
		}
	}

	public final TypeContext type() throws RecognitionException {
		TypeContext _localctx = new TypeContext(_ctx, getState());
		enterRule(_localctx, 26, RULE_type);
		try {
			setState(180);
			_errHandler.sync(this);
			switch (_input.LA(1)) {
			case T_INT:
				_localctx = new Type1Context(_localctx);
				enterOuterAlt(_localctx, 1);
				{
				setState(177);
				match(T_INT);
				}
				break;
			case T_DOUBLE:
				_localctx = new Type2Context(_localctx);
				enterOuterAlt(_localctx, 2);
				{
				setState(178);
				match(T_DOUBLE);
				}
				break;
			case T_BOOL:
				_localctx = new Type3Context(_localctx);
				enterOuterAlt(_localctx, 3);
				{
				setState(179);
				match(T_BOOL);
				}
				break;
			default:
				throw new NoViableAltException(this);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class VariableContext extends ParserRuleContext {
		public VariableContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_variable; }
	 
		public VariableContext() { }
		public void copyFrom(VariableContext ctx) {
			super.copyFrom(ctx);
		}
	}
	public static class Variable1Context extends VariableContext {
		public TerminalNode ID() { return getToken(CmmParser.ID, 0); }
		public Variable1Context(VariableContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterVariable1(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitVariable1(this);
		}
	}
	public static class Variable2Context extends VariableContext {
		public TerminalNode ID() { return getToken(CmmParser.ID, 0); }
		public TerminalNode L_BRACKET() { return getToken(CmmParser.L_BRACKET, 0); }
		public ExprContext expr() {
			return getRuleContext(ExprContext.class,0);
		}
		public TerminalNode R_BRACKET() { return getToken(CmmParser.R_BRACKET, 0); }
		public Variable2Context(VariableContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterVariable2(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitVariable2(this);
		}
	}

	public final VariableContext variable() throws RecognitionException {
		VariableContext _localctx = new VariableContext(_ctx, getState());
		enterRule(_localctx, 28, RULE_variable);
		try {
			setState(188);
			_errHandler.sync(this);
			switch ( getInterpreter().adaptivePredict(_input,12,_ctx) ) {
			case 1:
				_localctx = new Variable1Context(_localctx);
				enterOuterAlt(_localctx, 1);
				{
				setState(182);
				match(ID);
				}
				break;
			case 2:
				_localctx = new Variable2Context(_localctx);
				enterOuterAlt(_localctx, 2);
				{
				setState(183);
				match(ID);
				setState(184);
				match(L_BRACKET);
				setState(185);
				expr(0);
				setState(186);
				match(R_BRACKET);
				}
				break;
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class ConstantContext extends ParserRuleContext {
		public TerminalNode INT() { return getToken(CmmParser.INT, 0); }
		public TerminalNode DOUBLE() { return getToken(CmmParser.DOUBLE, 0); }
		public ConstantContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_constant; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterConstant(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitConstant(this);
		}
	}

	public final ConstantContext constant() throws RecognitionException {
		ConstantContext _localctx = new ConstantContext(_ctx, getState());
		enterRule(_localctx, 30, RULE_constant);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(190);
			_la = _input.LA(1);
			if ( !(_la==INT || _la==DOUBLE) ) {
			_errHandler.recoverInline(this);
			}
			else {
				if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
				_errHandler.reportMatch(this);
				consume();
			}
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class CompareContext extends ParserRuleContext {
		public CompareContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_compare; }
	 
		public CompareContext() { }
		public void copyFrom(CompareContext ctx) {
			super.copyFrom(ctx);
		}
	}
	public static class Compare1Context extends CompareContext {
		public TerminalNode LOG_NOT() { return getToken(CmmParser.LOG_NOT, 0); }
		public CompareContext compare() {
			return getRuleContext(CompareContext.class,0);
		}
		public Compare1Context(CompareContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterCompare1(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitCompare1(this);
		}
	}
	public static class Compare2Context extends CompareContext {
		public Token op;
		public List<ExprContext> expr() {
			return getRuleContexts(ExprContext.class);
		}
		public ExprContext expr(int i) {
			return getRuleContext(ExprContext.class,i);
		}
		public TerminalNode BIGGER_THAN() { return getToken(CmmParser.BIGGER_THAN, 0); }
		public TerminalNode LESS_THAN() { return getToken(CmmParser.LESS_THAN, 0); }
		public TerminalNode NO_LESS() { return getToken(CmmParser.NO_LESS, 0); }
		public TerminalNode NO_MORE() { return getToken(CmmParser.NO_MORE, 0); }
		public TerminalNode EQUAL() { return getToken(CmmParser.EQUAL, 0); }
		public TerminalNode UN_EQUAL() { return getToken(CmmParser.UN_EQUAL, 0); }
		public Compare2Context(CompareContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterCompare2(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitCompare2(this);
		}
	}
	public static class Compare3Context extends CompareContext {
		public ExprContext expr() {
			return getRuleContext(ExprContext.class,0);
		}
		public Compare3Context(CompareContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterCompare3(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitCompare3(this);
		}
	}

	public final CompareContext compare() throws RecognitionException {
		CompareContext _localctx = new CompareContext(_ctx, getState());
		enterRule(_localctx, 32, RULE_compare);
		int _la;
		try {
			setState(199);
			_errHandler.sync(this);
			switch ( getInterpreter().adaptivePredict(_input,13,_ctx) ) {
			case 1:
				_localctx = new Compare1Context(_localctx);
				enterOuterAlt(_localctx, 1);
				{
				setState(192);
				match(LOG_NOT);
				setState(193);
				compare();
				}
				break;
			case 2:
				_localctx = new Compare2Context(_localctx);
				enterOuterAlt(_localctx, 2);
				{
				setState(194);
				expr(0);
				setState(195);
				((Compare2Context)_localctx).op = _input.LT(1);
				_la = _input.LA(1);
				if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << NO_LESS) | (1L << NO_MORE) | (1L << EQUAL) | (1L << UN_EQUAL) | (1L << BIGGER_THAN) | (1L << LESS_THAN))) != 0)) ) {
					((Compare2Context)_localctx).op = (Token)_errHandler.recoverInline(this);
				}
				else {
					if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
					_errHandler.reportMatch(this);
					consume();
				}
				setState(196);
				expr(0);
				}
				break;
			case 3:
				_localctx = new Compare3Context(_localctx);
				enterOuterAlt(_localctx, 3);
				{
				setState(198);
				expr(0);
				}
				break;
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class ExprContext extends ParserRuleContext {
		public ExprContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_expr; }
	 
		public ExprContext() { }
		public void copyFrom(ExprContext ctx) {
			super.copyFrom(ctx);
		}
	}
	public static class MulExpr1Context extends ExprContext {
		public Token op;
		public List<ExprContext> expr() {
			return getRuleContexts(ExprContext.class);
		}
		public ExprContext expr(int i) {
			return getRuleContext(ExprContext.class,i);
		}
		public TerminalNode MUL() { return getToken(CmmParser.MUL, 0); }
		public TerminalNode DIV() { return getToken(CmmParser.DIV, 0); }
		public TerminalNode MOD() { return getToken(CmmParser.MOD, 0); }
		public MulExpr1Context(ExprContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterMulExpr1(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitMulExpr1(this);
		}
	}
	public static class Factor2Context extends ExprContext {
		public ConstantContext constant() {
			return getRuleContext(ConstantContext.class,0);
		}
		public Factor2Context(ExprContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterFactor2(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitFactor2(this);
		}
	}
	public static class Factor1Context extends ExprContext {
		public VariableContext variable() {
			return getRuleContext(VariableContext.class,0);
		}
		public Factor1Context(ExprContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterFactor1(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitFactor1(this);
		}
	}
	public static class Expr1Context extends ExprContext {
		public Token op;
		public List<ExprContext> expr() {
			return getRuleContexts(ExprContext.class);
		}
		public ExprContext expr(int i) {
			return getRuleContext(ExprContext.class,i);
		}
		public TerminalNode PLUS() { return getToken(CmmParser.PLUS, 0); }
		public TerminalNode MINUS() { return getToken(CmmParser.MINUS, 0); }
		public Expr1Context(ExprContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterExpr1(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitExpr1(this);
		}
	}
	public static class Factor4Context extends ExprContext {
		public TerminalNode L_PAREN() { return getToken(CmmParser.L_PAREN, 0); }
		public TerminalNode MINUS() { return getToken(CmmParser.MINUS, 0); }
		public ExprContext expr() {
			return getRuleContext(ExprContext.class,0);
		}
		public TerminalNode R_PAREN() { return getToken(CmmParser.R_PAREN, 0); }
		public Factor4Context(ExprContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterFactor4(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitFactor4(this);
		}
	}
	public static class Factor3Context extends ExprContext {
		public TerminalNode L_PAREN() { return getToken(CmmParser.L_PAREN, 0); }
		public ExprContext expr() {
			return getRuleContext(ExprContext.class,0);
		}
		public TerminalNode R_PAREN() { return getToken(CmmParser.R_PAREN, 0); }
		public Factor3Context(ExprContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).enterFactor3(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof CmmListener ) ((CmmListener)listener).exitFactor3(this);
		}
	}

	public final ExprContext expr() throws RecognitionException {
		return expr(0);
	}

	private ExprContext expr(int _p) throws RecognitionException {
		ParserRuleContext _parentctx = _ctx;
		int _parentState = getState();
		ExprContext _localctx = new ExprContext(_ctx, _parentState);
		ExprContext _prevctx = _localctx;
		int _startState = 34;
		enterRecursionRule(_localctx, 34, RULE_expr, _p);
		int _la;
		try {
			int _alt;
			enterOuterAlt(_localctx, 1);
			{
			setState(213);
			_errHandler.sync(this);
			switch ( getInterpreter().adaptivePredict(_input,14,_ctx) ) {
			case 1:
				{
				_localctx = new Factor1Context(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;

				setState(202);
				variable();
				}
				break;
			case 2:
				{
				_localctx = new Factor2Context(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;
				setState(203);
				constant();
				}
				break;
			case 3:
				{
				_localctx = new Factor3Context(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;
				setState(204);
				match(L_PAREN);
				setState(205);
				expr(0);
				setState(206);
				match(R_PAREN);
				}
				break;
			case 4:
				{
				_localctx = new Factor4Context(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;
				setState(208);
				match(L_PAREN);
				setState(209);
				match(MINUS);
				setState(210);
				expr(0);
				setState(211);
				match(R_PAREN);
				}
				break;
			}
			_ctx.stop = _input.LT(-1);
			setState(223);
			_errHandler.sync(this);
			_alt = getInterpreter().adaptivePredict(_input,16,_ctx);
			while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
				if ( _alt==1 ) {
					if ( _parseListeners!=null ) triggerExitRuleEvent();
					_prevctx = _localctx;
					{
					setState(221);
					_errHandler.sync(this);
					switch ( getInterpreter().adaptivePredict(_input,15,_ctx) ) {
					case 1:
						{
						_localctx = new MulExpr1Context(new ExprContext(_parentctx, _parentState));
						pushNewRecursionContext(_localctx, _startState, RULE_expr);
						setState(215);
						if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)");
						setState(216);
						((MulExpr1Context)_localctx).op = _input.LT(1);
						_la = _input.LA(1);
						if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << MUL) | (1L << DIV) | (1L << MOD))) != 0)) ) {
							((MulExpr1Context)_localctx).op = (Token)_errHandler.recoverInline(this);
						}
						else {
							if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
							_errHandler.reportMatch(this);
							consume();
						}
						setState(217);
						expr(7);
						}
						break;
					case 2:
						{
						_localctx = new Expr1Context(new ExprContext(_parentctx, _parentState));
						pushNewRecursionContext(_localctx, _startState, RULE_expr);
						setState(218);
						if (!(precpred(_ctx, 5))) throw new FailedPredicateException(this, "precpred(_ctx, 5)");
						setState(219);
						((Expr1Context)_localctx).op = _input.LT(1);
						_la = _input.LA(1);
						if ( !(_la==PLUS || _la==MINUS) ) {
							((Expr1Context)_localctx).op = (Token)_errHandler.recoverInline(this);
						}
						else {
							if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
							_errHandler.reportMatch(this);
							consume();
						}
						setState(220);
						expr(6);
						}
						break;
					}
					} 
				}
				setState(225);
				_errHandler.sync(this);
				_alt = getInterpreter().adaptivePredict(_input,16,_ctx);
			}
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			unrollRecursionContexts(_parentctx);
		}
		return _localctx;
	}

	public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
		switch (ruleIndex) {
		case 17:
			return expr_sempred((ExprContext)_localctx, predIndex);
		}
		return true;
	}
	private boolean expr_sempred(ExprContext _localctx, int predIndex) {
		switch (predIndex) {
		case 0:
			return precpred(_ctx, 6);
		case 1:
			return precpred(_ctx, 5);
		}
		return true;
	}

	public static final String _serializedATN =
		"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3-\u00e5\4\2\t\2\4"+
		"\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t"+
		"\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
		"\4\23\t\23\3\2\6\2(\n\2\r\2\16\2)\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3"+
		"\3\3\5\3\66\n\3\3\4\3\4\3\4\3\4\7\4<\n\4\f\4\16\4?\13\4\3\4\3\4\3\4\3"+
		"\4\3\4\3\4\3\4\3\4\3\4\5\4J\n\4\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\5\5T\n"+
		"\5\3\6\3\6\3\6\3\6\3\6\3\6\7\6\\\n\6\f\6\16\6_\13\6\3\6\3\6\3\6\3\6\3"+
		"\6\3\6\7\6g\n\6\f\6\16\6j\13\6\3\6\3\6\5\6n\n\6\3\7\3\7\3\7\3\7\3\7\3"+
		"\7\3\b\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n"+
		"\3\n\5\n\u0088\n\n\3\13\3\13\3\13\3\13\3\13\3\13\3\f\3\f\3\f\3\f\3\f\3"+
		"\f\3\r\3\r\7\r\u0098\n\r\f\r\16\r\u009b\13\r\3\r\3\r\3\16\3\16\3\16\3"+
		"\16\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3"+
		"\16\3\16\5\16\u00b2\n\16\3\17\3\17\3\17\5\17\u00b7\n\17\3\20\3\20\3\20"+
		"\3\20\3\20\3\20\5\20\u00bf\n\20\3\21\3\21\3\22\3\22\3\22\3\22\3\22\3\22"+
		"\3\22\5\22\u00ca\n\22\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23"+
		"\3\23\3\23\5\23\u00d8\n\23\3\23\3\23\3\23\3\23\3\23\3\23\7\23\u00e0\n"+
		"\23\f\23\16\23\u00e3\13\23\3\23\2\3$\24\2\4\6\b\n\f\16\20\22\24\26\30"+
		"\32\34\36 \"$\2\6\3\2\'(\3\2\25\32\3\2 \"\3\2\36\37\2\u00ee\2\'\3\2\2"+
		"\2\4\65\3\2\2\2\6I\3\2\2\2\bS\3\2\2\2\nm\3\2\2\2\fo\3\2\2\2\16u\3\2\2"+
		"\2\20x\3\2\2\2\22\u0087\3\2\2\2\24\u0089\3\2\2\2\26\u008f\3\2\2\2\30\u0095"+
		"\3\2\2\2\32\u00b1\3\2\2\2\34\u00b6\3\2\2\2\36\u00be\3\2\2\2 \u00c0\3\2"+
		"\2\2\"\u00c9\3\2\2\2$\u00d7\3\2\2\2&(\5\4\3\2\'&\3\2\2\2()\3\2\2\2)\'"+
		"\3\2\2\2)*\3\2\2\2*\3\3\2\2\2+\66\5\6\4\2,\66\5\n\6\2-\66\5\20\t\2./\5"+
		"\22\n\2/\60\7#\2\2\60\66\3\2\2\2\61\66\5\24\13\2\62\66\5\26\f\2\63\66"+
		"\5\30\r\2\64\66\5\32\16\2\65+\3\2\2\2\65,\3\2\2\2\65-\3\2\2\2\65.\3\2"+
		"\2\2\65\61\3\2\2\2\65\62\3\2\2\2\65\63\3\2\2\2\65\64\3\2\2\2\66\5\3\2"+
		"\2\2\678\5\34\17\28=\5\b\5\29:\7$\2\2:<\5\b\5\2;9\3\2\2\2<?\3\2\2\2=;"+
		"\3\2\2\2=>\3\2\2\2>@\3\2\2\2?=\3\2\2\2@A\7#\2\2AJ\3\2\2\2BC\5\34\17\2"+
		"CD\7\21\2\2DE\7\'\2\2EF\7\22\2\2FG\7&\2\2GH\7#\2\2HJ\3\2\2\2I\67\3\2\2"+
		"\2IB\3\2\2\2J\7\3\2\2\2KT\7&\2\2LM\7&\2\2MN\7%\2\2NT\5$\23\2OP\7&\2\2"+
		"PQ\7%\2\2QR\7\37\2\2RT\5$\23\2SK\3\2\2\2SL\3\2\2\2SO\3\2\2\2T\t\3\2\2"+
		"\2UV\7\4\2\2VW\7\17\2\2WX\5\"\22\2XY\7\20\2\2Y]\5\30\r\2Z\\\5\f\7\2[Z"+
		"\3\2\2\2\\_\3\2\2\2][\3\2\2\2]^\3\2\2\2^n\3\2\2\2_]\3\2\2\2`a\7\4\2\2"+
		"ab\7\17\2\2bc\5\"\22\2cd\7\20\2\2dh\5\30\r\2eg\5\f\7\2fe\3\2\2\2gj\3\2"+
		"\2\2hf\3\2\2\2hi\3\2\2\2ik\3\2\2\2jh\3\2\2\2kl\5\16\b\2ln\3\2\2\2mU\3"+
		"\2\2\2m`\3\2\2\2n\13\3\2\2\2op\7\6\2\2pq\7\17\2\2qr\5\"\22\2rs\7\20\2"+
		"\2st\5\30\r\2t\r\3\2\2\2uv\7\5\2\2vw\5\30\r\2w\17\3\2\2\2xy\7\7\2\2yz"+
		"\7\17\2\2z{\5\"\22\2{|\7\20\2\2|}\5\30\r\2}\21\3\2\2\2~\177\5\36\20\2"+
		"\177\u0080\7%\2\2\u0080\u0081\5$\23\2\u0081\u0088\3\2\2\2\u0082\u0083"+
		"\5\36\20\2\u0083\u0084\7%\2\2\u0084\u0085\7\37\2\2\u0085\u0086\5$\23\2"+
		"\u0086\u0088\3\2\2\2\u0087~\3\2\2\2\u0087\u0082\3\2\2\2\u0088\23\3\2\2"+
		"\2\u0089\u008a\7\r\2\2\u008a\u008b\7\17\2\2\u008b\u008c\5$\23\2\u008c"+
		"\u008d\7\20\2\2\u008d\u008e\7#\2\2\u008e\25\3\2\2\2\u008f\u0090\7\16\2"+
		"\2\u0090\u0091\7\17\2\2\u0091\u0092\5\36\20\2\u0092\u0093\7\20\2\2\u0093"+
		"\u0094\7#\2\2\u0094\27\3\2\2\2\u0095\u0099\7\23\2\2\u0096\u0098\5\4\3"+
		"\2\u0097\u0096\3\2\2\2\u0098\u009b\3\2\2\2\u0099\u0097\3\2\2\2\u0099\u009a"+
		"\3\2\2\2\u009a\u009c\3\2\2\2\u009b\u0099\3\2\2\2\u009c\u009d\7\24\2\2"+
		"\u009d\31\3\2\2\2\u009e\u009f\7\3\2\2\u009f\u00a0\7\17\2\2\u00a0\u00a1"+
		"\5\22\n\2\u00a1\u00a2\7#\2\2\u00a2\u00a3\5\"\22\2\u00a3\u00a4\7#\2\2\u00a4"+
		"\u00a5\5\22\n\2\u00a5\u00a6\7\20\2\2\u00a6\u00a7\5\30\r\2\u00a7\u00b2"+
		"\3\2\2\2\u00a8\u00a9\7\3\2\2\u00a9\u00aa\7\17\2\2\u00aa\u00ab\5\6\4\2"+
		"\u00ab\u00ac\5\"\22\2\u00ac\u00ad\7#\2\2\u00ad\u00ae\5\22\n\2\u00ae\u00af"+
		"\7\20\2\2\u00af\u00b0\5\30\r\2\u00b0\u00b2\3\2\2\2\u00b1\u009e\3\2\2\2"+
		"\u00b1\u00a8\3\2\2\2\u00b2\33\3\2\2\2\u00b3\u00b7\7\13\2\2\u00b4\u00b7"+
		"\7\n\2\2\u00b5\u00b7\7\f\2\2\u00b6\u00b3\3\2\2\2\u00b6\u00b4\3\2\2\2\u00b6"+
		"\u00b5\3\2\2\2\u00b7\35\3\2\2\2\u00b8\u00bf\7&\2\2\u00b9\u00ba\7&\2\2"+
		"\u00ba\u00bb\7\21\2\2\u00bb\u00bc\5$\23\2\u00bc\u00bd\7\22\2\2\u00bd\u00bf"+
		"\3\2\2\2\u00be\u00b8\3\2\2\2\u00be\u00b9\3\2\2\2\u00bf\37\3\2\2\2\u00c0"+
		"\u00c1\t\2\2\2\u00c1!\3\2\2\2\u00c2\u00c3\7\33\2\2\u00c3\u00ca\5\"\22"+
		"\2\u00c4\u00c5\5$\23\2\u00c5\u00c6\t\3\2\2\u00c6\u00c7\5$\23\2\u00c7\u00ca"+
		"\3\2\2\2\u00c8\u00ca\5$\23\2\u00c9\u00c2\3\2\2\2\u00c9\u00c4\3\2\2\2\u00c9"+
		"\u00c8\3\2\2\2\u00ca#\3\2\2\2\u00cb\u00cc\b\23\1\2\u00cc\u00d8\5\36\20"+
		"\2\u00cd\u00d8\5 \21\2\u00ce\u00cf\7\17\2\2\u00cf\u00d0\5$\23\2\u00d0"+
		"\u00d1\7\20\2\2\u00d1\u00d8\3\2\2\2\u00d2\u00d3\7\17\2\2\u00d3\u00d4\7"+
		"\37\2\2\u00d4\u00d5\5$\23\2\u00d5\u00d6\7\20\2\2\u00d6\u00d8\3\2\2\2\u00d7"+
		"\u00cb\3\2\2\2\u00d7\u00cd\3\2\2\2\u00d7\u00ce\3\2\2\2\u00d7\u00d2\3\2"+
		"\2\2\u00d8\u00e1\3\2\2\2\u00d9\u00da\f\b\2\2\u00da\u00db\t\4\2\2\u00db"+
		"\u00e0\5$\23\t\u00dc\u00dd\f\7\2\2\u00dd\u00de\t\5\2\2\u00de\u00e0\5$"+
		"\23\b\u00df\u00d9\3\2\2\2\u00df\u00dc\3\2\2\2\u00e0\u00e3\3\2\2\2\u00e1"+
		"\u00df\3\2\2\2\u00e1\u00e2\3\2\2\2\u00e2%\3\2\2\2\u00e3\u00e1\3\2\2\2"+
		"\23)\65=IS]hm\u0087\u0099\u00b1\u00b6\u00be\u00c9\u00d7\u00df\u00e1";
	public static final ATN _ATN =
		new ATNDeserializer().deserialize(_serializedATN.toCharArray());
	static {
		_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
		for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
			_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
		}
	}
}